/**
 * Created with Intellij JDEA
 * Description:
 * User:
 * Date:2022-03-22
 * Time:20:05
 */
public class 如果相邻两个颜色均相同则删除当前颜色 {
    public boolean winnerOfGame(String colors) {
        char[] ch = colors.toCharArray();
        int len = ch.length;
        int a = 0,b = 0;
        for (int i = 1; i < len - 1; i++) {
            if (ch[i] == 'A' && ch[i-1] == 'A' && ch[i+1] == 'A'){
                a++;
            }
            if (ch[i] == 'B' && ch[i-1] == 'B' && ch[i+1] == 'B') {
                b++;
            }
        }
        return a > b;
    }
}
